package com.example.zhidao.config;

import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class MPConfig {
    @Bean
//    下面的函数相当于交给spring管理一个bean
    public MybatisPlusInterceptor lanjieqi(){
//        将mp的拦截器创建出来，返回出去
        MybatisPlusInterceptor a=new MybatisPlusInterceptor();
        a.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));//拦截器添加分页功能
        return a;
    }
}
